package com.objectproject.main.model;

import java.sql.Timestamp;

public class MyGroup {
	
	
	private long groupId;
	private Timestamp regDate;
	
	
	private boolean isPrivate;//사설그룹-공적그룹인지 
	private boolean isSystem;//시스템 그룹인지 - 일반 서비스로는 가입할 수 없음
	private MyGroup owner;
	
	//detail
	private String title;
	private String isATitle;
	

	public long getGroupId() {
		return groupId;
	}
	public void setGroupId(long groupId) {
		this.groupId = groupId;
	}
	public Timestamp getRegDate() {
		return regDate;
	}
	public void setRegDate(Timestamp regDate) {
		this.regDate = regDate;
	}
	public boolean isPrivate() {
		return isPrivate;
	}
	public void setPrivate(boolean isPrivate) {
		this.isPrivate = isPrivate;
	}
	public boolean isSystem() {
		return isSystem;
	}
	public void setSystem(boolean isSystem) {
		this.isSystem = isSystem;
	}
	
	public MyGroup getOwner() {
		return owner;
	}
	public void setOwner(MyGroup owner) {
		this.owner = owner;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getIsATitle() {
		return isATitle;
	}
	public void setIsATitle(String isATitle) {
		this.isATitle = isATitle;
	}
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof MyGroup){
			if(((MyGroup) obj).groupId == 0 || this.groupId == 0){
				return false;
			}else if(((MyGroup)obj).groupId == this.groupId){
				return true;
			}
		}
		return false;
	}
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("groupId : " + this.groupId + "\n");
		sb.append("regDate : " + this.regDate + "\n");
		sb.append("title : " + this.title + "\n");
		sb.append("isATitle : " + this.isATitle + "\n");
		sb.append("isPrivate : " + this.isPrivate + "\n");
		sb.append("isSystem : " + this.isSystem + "\n");
		if(owner != null)
			sb.append("owner : " + this.owner.groupId + "\n\n");
		return sb.toString();
	}
	
	

}
